#ifndef TIEC_PARSER_H
#define TIEC_PARSER_H

#include "tree.h"
#include "lexer.h"
#include "component.h"

namespace NS_TIEC {
  /// 语法解析器
  class Parser {
  public:
    /// 解析一个编译单元，即一个源代码文件
    /// \return CompilationUnitTree
    virtual PTR<CompilationUnitTree> parseCompilationUnit() = 0;

    /// 解析语句
    /// \return StatementTree
    virtual PTR<StatementTree> parseStatement() = 0;

    /// 解析表达式
    /// \return ExpressionTree
    virtual PTR<ExpressionTree> parseExpression() = 0;

    /// 解析类型表达式
    /// \return ExpressionTree
    virtual PTR<ExpressionTree> parseType() = 0;

    /// 解析嵌入式代码
    /// \return CodeTree
    virtual PTR<CodeTree> parseCode() = 0;
  };
}

#endif //TIEC_PARSER_H
